#include "junix.h"
#include <boost/functional/hash.hpp>
#include <boost/tuple/tuple.hpp>

using namespace std;

struct A
{
	int i;
	int j;

	friend size_t hash_value( const A& a)
	{
		size_t seed = 0;
		boost::hash_combine(seed, a.i);
		boost::hash_combine(seed, a.j);

		return seed;
	}
};

int main(int argc, char **argv)
{
	boost::hash<int> hashi;
	cout<<hashi(99)<<endl;
	cout<<hashi(99999)<<endl;

	boost::hash<char> hc;
	cout<<hc('X')<<endl;
	cout<<hc('^')<<endl;

	boost::hash<std::string> hs;
	cout<<hs(std::string("hello,world"))<<endl;
	cout<<hs(std::string("hello,world."))<<endl;

	/*
	boost::hash<char*> hcp;
	cout<<hcp("hello,world.")<<endl;
	std::cout<<hcp("hello")<<endl;
	*/

	boost::hash<double> hd;
	cout<<hd(0.001)<<endl;
	cout<<hd(0.0010)<<endl;

	boost::hash< std::pair<int, std::string> > hp;
	cout<<hp( make_pair(123, std::string("hello,world")) )<<endl;
	cout<<hp( make_pair(1234, std::string("hello,world")) )<<endl;
	cout<<hp( make_pair(1234, std::string("hello,world.")) )<<endl;

	/*
	boost::hash< boost::tuple::tuple<int, char, std::string> > hICST;
	cout<<hICST( boost::make_tuple(1,'Q',std::string("hello")))<<endl;
	*/

	boost::hash<A> ha;
	A a={122,155};
	cout<<ha(a)<<endl;

}
